package com.dailyblue.example.springcloud.config;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;

@Slf4j
@SpringBootApplication
@RefreshScope
public class CloudExampleNacosConfigApplication {
    @SneakyThrows
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(CloudExampleNacosConfigApplication.class, args);
        // 硬编码方式
        /*Thread.sleep(3000);

        while (true) {
            String id = context.getEnvironment().getProperty("student.id");
            String name = context.getEnvironment().getProperty("student.name");
            String gender = context.getEnvironment().getProperty("student.gender");
            log.info("id:{},name:{},gender:{}", id, name, gender);
            Thread.sleep(1000);
        }*/
    }
}